title = "order-info"
url = "/:slug|orderdetail-\d+.html$"
description = "订单详情页面"
is_hidden = 0
layout = "default"


[session]
security = "user"
redirect = "account/login"
==
function onStart() {
header("Content-type: text/html; charset=utf-8");
$userid_login = $this['user']['attributes']['id'];
$slugArr = explode('-', str_replace('.html', '', $this->param('slug')));
//$sn = "1450348359";
$sn = $slugArr['1'];
$this['sn'] = $sn;

$order = App::make('Jason\Ccshop\Controllers\Orders')->orderDetail($sn);
$userid_order = $order['attributes']['uid'];
if($order == null){
//exit('null result');
return redirect('/404');
}
if($userid_order != $userid_login){
//exit('you cannot lookfor someone else's orders');
return redirect('/404');
}
$this['order'] = $order;
//$this['orderarr'] = $order->attributes;
//var_dump($this['orderarr']);
}
==
<!-- contents -->
<div id="contents">
	<nav class="crumbs_nav">
		<ul class="crumbs_list rdstr">
			<li class="crumbs_item">
				<a class="crumbs_link" href="/">
					<span>{{ 'Home'|_ }}</span>
				</a>
			</li>
			<li class="crumbs_item">
				<a class="crumbs_link" href="{{ 'account/dashboard'|page }}">
					<span>{{ 'My account'|_ }}</span>
				</a>
			</li>
			<li class="crumbs_item no_deco">
				<span class="crumbs_link">{{ 'My order'|_ }}</span>
			</li>
		</ul>
	</nav>
	<h3 class="title_main">{{ 'My order'|_ }}</h3>
	<section>
      <h4 class="title3">{{ 'Order detail'|_ }}：</h4>
      <ul class="order-detail">
      	<li>{{ 'Order number'|_ }}：{{ order.sn }}</li>
      	<li>{{ 'Order time'|_ }}：{{ order.created_at }}</li>
      	<li>{{ 'People under the order '|_ }}：{{ order.lastname }} {{ order.firstname }}</li>
      	<li>{{ 'E-mail address'|_ }}：{{ order.email }}</li>
      	<li>{{ 'Phone number'|_ }}：{{ order.phonenumber }}</li>
      	<li>{{ 'Address'|_ }}：{{ order.country.name }}, {{ order.state.name }}, {{ order.city }}, {{ order.address }}</li>
      	<li>{{ 'Postcode'|_ }}：{{ order.postcode }}</li>
      	<li>{{ 'Shipping method'|_ }}：{{ order.shippingmethod.name }}</li>
      	<li>{{ 'Payment method'|_ }}：{{ order.paymentmethod.name }}</li>
      	<li>{{ 'Oeder amount'|_ }}：{{ order.products_price|formatPriceNotRate }}</li>
      	<li>{{ 'Freight'|_ }}：{{ order.freight|formatPriceNotRate }}</li>
      	<li>{{ 'Total amont'|_ }}：{{ order.total_price|formatPriceNotRate }}</li>
      </ul>
      <h4 class="title3">{{ 'Order list'|_ }}：</h4>
      <ul class="list_product_line list_product_line_checkbox clearfix mt0">
        {% for m, orderproduct in order.products %}
        {% set condition = { 'id': orderproduct.product_id } %}
        {% set product = catalog.product(condition) %}
        <li class="list_product_item">
          <div class="box_list">
            <div class="list_product_link box_list_main">
              <div class="list_product_frame">
                <div class="list_product_img_block">
                  <img src="{{ product.getMainThumb(67,90) }}" alt="{{ orderproduct.name }}">
                </div>
                <div class="list_product_text_block">
                  <a class="db" href="{{ product.url }}">
                    <!-- <p class="list_product_brand rdstr">Felt Maglietta</p> -->
                    <p class="list_product_name">{{ orderproduct.name }}</p>
                    <p class="list_product_category rdstr">{{ 'Products detail '|_ }}:
                        {% for keyoption, option in orderproduct.options %}
                        {{keyoption}}:
                        {% for key, optionvalue in option %}
                           {{optionvalue}}
                        {% endfor %}
                        <br>
                        {% endfor %}
                    </p>
                    <p class="list_product_category rdstr">
                      <span class="force_color">{{ 'Unit price'|_ }}: {{ orderproduct.price|formatPriceNotRate }}</span>
                    </p>
                    <p class="list_product_price_block rdstr pricedownView">
                      <span class="list_product_price force_color">{{ 'Product price'|_ }}: {{ (orderproduct.price * orderproduct.qty)|formatPriceNotRate }}</span>
                      <span class="list_product_pricedown force_color">{{ 'Number'|_ }}: {{ orderproduct.qty }}</span>
                    </p>
                  </a>
                </div>
              </div>
            </div>
          </div>
        </li>
        {% endfor %}
        </ul>
    </section>
</div>
<!-- end contents -->